-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: ExtensionArray unique and repeat #41260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Right, my thought is making those Literal would make it more obvious to
readers that it is for DataFrame
…On Sun, May 2, 2021 at 6:57 PM Irv Lustig ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pandas/core/arrays/interval.py
<#41260 (comment)>:
> @@ -1518,7 +1518,11 @@ def delete(self: IntervalArrayT, loc) -> IntervalArrayT:
return self._shallow_copy(left=new_left, right=new_right)
@appender(_extension_array_shared_docs["repeat"] % _shared_docs_kwargs)
- def repeat(self: IntervalArrayT, repeats: int, axis=None) -> IntervalArrayT:
+ def repeat(
+ self: IntervalArrayT,
+ repeats: int | Sequence[int],
+ axis: int | None = None,
@jbrockmendel <https://github.com/jbrockmendel> No, we can't accept those
arguments in ExtensionArray.repeat(), because we call numpy.repeat
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#41260 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB5UM6DILM4G7I7URYA2SDTTLX7I7ANCNFSM4364DQ3A>
.
|
@jbrockmendel Except that there is no |
pd._typing.Axis is intended for use in Series/DataFrame methods, not in EA methods. But that is not obvious to all readers (as evidenced by the initial suggestion to use it here). So I was suggesting an edit that might make it clearer to the next reader. Out of scope for this PR. |
right my main point here is that we should have exactly 1 canonical way to type things and it should be obvious. If its not it needs lots of comments / expl and is not ideal at all, otherwise we are going to get inconsistencies across the board. if there is a way to enforce this would be great. in any event this PR is fine. |
Typing fixes for
ExtensionArray.unique()
andExtensionArray.repeat()